import React, { Component } from 'react';
import './Cate.scss'
import { withRouter } from 'react-router-dom'
class Cate extends Component {
    goAllgood=(id)=>{
        console.log(id);
        this.props.history.push({pathname:'/index/allgood',state:{id}})
    }
    render() {
        return (
            <div className='container'>
                {
                    this.props.arr.map((item,index)=>{
                        return (
                            <div key={index} onClick={()=>{this.goAllgood(item.id)}}>
                                <img src={item.pic} alt="" />
                                <span>{item.name}</span>
                            </div>
                        )
                    })
                }
            </div>
        );
    }
}

export default withRouter(Cate);